var t = getApp();

Page({
    data: {
        isSelect: "",
        shop_id: "",
        state: {
            adv_img: "",
            adv_url: ""
        },
        list: [],
        contentlist: {},
        shoplang: ""
    },
    onLoad: function(t) {
        t.isSelect && this.setData({
            isSelect: t.isSelect
        }), t.shop_id && this.setData({
            shop_id: t.shop_id
        }), this.getList();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    gomicroShopCategory: function() {},
    getList: function() {
        var a = this, e = t.getNetAddresss("plugin.micro.frontend.controllers.MicroShop.CategoryByShare.getCategory");
        e += "&shop_id=" + a.data.shop_id, t._getNetWork({
            url: e,
            success: function(e) {
                var s = e.data;
                if (1 == s.result) {
                    if (a.setData({
                        list: s.data.data
                    }), s.data.lang && (a.setData({
                        shoplang: s.data.lang
                    }), wx.setNavigationBarTitle({
                        title: a.data.shoplang + "分类"
                    })), t._isTextEmpty(s.data) || t._isTextEmpty(s.data.data) || t._isTextEmpty(s.data.data[0])) return;
                    a.tabsaData(0, s.data.data[0]);
                }
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    tabsaData: function(t, a) {
        this.setData({
            "state.adv_img": a.adv_img,
            "state.adv_url": a.adv_url
        }), this.setData({
            active: t,
            active2: !1
        }), this.getContentlist(a.id);
    },
    getContentlist: function(a) {
        var e = this, s = t.getNetAddresss("plugin.micro.frontend.controllers.MicroShop.CategoryByShare.getChildrenCategory");
        s += "&parent_id=" + a, s += "&shop_id=" + e.data.shop_id, t._getNetWork({
            url: s,
            success: function(t) {
                var a = t.data;
                if (1 == a.result) {
                    var s = {
                        data: a.data.data,
                        tjfl: !1,
                        set: a.data.set
                    };
                    e.setData({
                        err: !1,
                        contentlist: s
                    });
                } else e.setData({
                    err: !0
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    tabsa: function(t) {
        var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.item;
        this.tabsaData(a, e);
    }
});